﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Deployment.BuildManager.ExternalProcess.CreateSetupFile
{
    public class SetupApplication : System.Windows.Application
    {
        public string AdditionalCommandParameters { get; set; }

        public SetupApplication()
        {
            this.Startup += new System.Windows.StartupEventHandler(SetupApplication_Startup);
        }

        void SetupApplication_Startup(object sender, System.Windows.StartupEventArgs e)
        {
            Setup window = new Setup();

            string message;

            if (window.ValidateInstalledSystem(out message))
            {
                window.AdditionalCommandParameters = AdditionalCommandParameters;
                window.ShowDialog();
            }
            else
            {
                window.ShowMessage(message);
            }

            this.Shutdown(window.ExitCode);
        }
    }
}
